<?php

namespace home\controller;

use home\model\CommentModel;

class CommentController{

    private $comment;

    public function __construct(){
        $this->comment = new CommentModel();
    }

    /**
     * 获取指定 id 的评论信息
     */
    public function queryComment($params){
        $data = $this->comment->queryCommentReplayAll($params);
        return json_encode($data);
    }

    /**
     * 提交留言内容
     */
    public function submitComment($params){
        $params['time'] = time();
        $data = $this->comment->submitComment($params);
        return $data;
    }
    /**
     * 增加阅读数量
    */
    public function addPrasise($params){
        return $this->comment->addPrasise($params);
    }
    /**
     * 追加留言
     */
    public function commentReplay($params){
        $params['time'] = time();
        return $this->comment->submitCommentReplay($params);
    }

}
